package com.biz.imp;

import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bean.Market;
import com.bean.Users;
import com.biz.UsersBiz;
import com.service.MapperService;
@Service
@Transactional
public class UsersBizImp implements UsersBiz {
	@Autowired
	private MapperService mapperService;
	
	public MapperService getMapperService() {
		return mapperService;
	}

	public void setMapperService(MapperService mapperService) {
		this.mapperService = mapperService;
	}

	public int save(Users users) {
		int code=mapperService.getUsersMapper().insert(users);
		return code;
	}

	public int update(Users users) {
		int code=mapperService.getUsersMapper().updateByPrimaryKey(users);
		return code;
	}

	public int delById(Integer uid) {
		int code=mapperService.getUsersMapper().deleteByPrimaryKey(uid);
		return code;
	}

	public Users findById(Integer uid) {
		Users us=mapperService.getUsersMapper().selectByPrimaryKey(uid);
		return us;
	}

	public List<Users> findPageAll(int page, int rows) {
		if(page<1)page=1;
		if(rows<1)rows=5;
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("page", page);
		map.put("rows", rows);
		List<Users> lsus=mapperService.getUsersMapper().findPageAll(map);
		return lsus;
	}

	public int findMaxRow() {
		
		return mapperService.getUsersMapper().findMaxRow();
	}

	public Users check(Users users) {
		if(users!=null){
			return mapperService.getUsersMapper().check(users);
		}
		return null;
	}

}
